package com.rongke.web.h5controller;

import com.rongke.model.Doctor;
import com.rongke.service.DoctorService;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @UserController
 * @Controller
 * @version : Ver 1.0
 */
@Controller
public class ExpertInfoController {
	private static final Logger LOGGER = Logger
			.getLogger(ExpertInfoController.class);

	@Autowired
	private DoctorService doctorService;

	/**
	 * 单个新闻详情
	 * 
	 * @param newsId
	 * @return
	 */
	@RequestMapping(value = "/expert/doctorDetail.html")
	public ModelAndView viewDoctorInfo(long expertId) {
		try {
			ModelAndView result = new ModelAndView();

			Doctor doctorInfo = doctorService.selectById(expertId);
			if (null == doctorInfo) {
				result.setViewName("common/404");
				return result;
			}

			result.addObject("doctor", doctorInfo);
			result.setViewName("expert/expert_detail");

			return result;
		} catch (Exception e) {
			LOGGER.error("viewDoctorInfo failed", e);
			throw e;
		}
	}

}
